/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aso.upna.filesystem;

/**
 *
 * @author triki
 */
public class FileIterator {

    private String[] privateArray;
    private int counter;

    public FileIterator(String[] array)
    {
        counter = 0;
        this.privateArray = array;
    }

    public boolean hasNext()
    {
        int aux;
        String aux2 = null;

        try
        {
            aux = counter + 1;
            aux2 = privateArray[aux];
            return true;
        }
        catch(IndexOutOfBoundsException ex)
        {
            return false;
        }
    }

    public String current()
    {
        return privateArray[counter];
    }

    public void next()
    {
        counter+=1;
    }

    public void previous()
    {
        counter-=1;
        
        if(counter < 0)
            counter = 0;
    }
    
    public void first()
    {
        counter = 0;
    }
}
